﻿using Exam.DAL;
using Exam.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Exam.BLL
{
    public class ShoppingBLL
    {
        ShoppingDAL dal;
        public ShoppingBLL()
        {
            dal = new ShoppingDAL();
        }

        /// <summary>
        /// 用于登录
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public bool Login(string username,string pwd)
        {
            return dal.Login(username, pwd);
        }
        /// <summary>
        /// 用于添加商品
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public bool AddProduct(Product product)
        {
            return dal.AddProduct(product);
        }
        /// <summary>
        /// 用于删除商品
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool RemoveProduct(int? id)
        {
            return dal.RemoveProduct(id);
        }

        /// <summary>
        /// 用于查询所有商品
        /// </summary>
        /// <returns></returns>
        public List<Product> GetProducts()
        {
            return dal.GetProducts();
        }

        /// <summary>
        /// 根据id查找产品
        /// </summary>
        /// <param name="id">产品id</param>
        /// <returns></returns>
        public Product GetProducts(int? id)
        {
            return dal.GetProducts(id);
        }

        /// <summary>
        /// 更改产品
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public bool ModifyProduct(Product product)
        {
            return dal.ModifyProduct(product);
        }


    }
}